package com.example.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.example.demo.dto.SearchInfo;
import com.example.demo.entity.Nursingplan;



@Repository()
	
	public interface Nursingplan_Mapper extends BaseMapper<Nursingplan> {
		
		@Select("select nursingplan.*,patient.name patient_name "
				+ " from nursingplan inner join patient on nursingplan.patient_id=patient.id   ${where} ${limitstr}")
		public List<Nursingplan> select(SearchInfo info);
		
		@Select("select count(1) from nursingplan inner join patient on nursingplan.patient_id=patient.id   ${where} ")
		public long selectCount(SearchInfo info);
		
		@Insert("insert into nursingplan (patient_id,plan_date,plancontent) values(#{patient_id},#{plan_date},#{plancontent})")
		public void insert (Nursingplan np);
		
		@Update("update nursingplan set patient_id=#{patient_id},plan_date=#{plan_date},plancontent=#{plancontent} where id=#{id}")
		public void update (Nursingplan np);
		
		@Delete("delete from nursingplan where id=#{id}")
		public void delete(int id);
		
		@Select("select * from nursingplan where id=#{id} ")
		public Nursingplan selectById(int id);
	}
	

